-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[META 388] Proposal for collecting Azure App Service cloud metadata #365
Conversation
This commit updates the cloud metadata spec to propose collecting Azure App Service metadata. Azure App Services are a very popular PaaS offering on Azure. In contrast to Azure VMs, App Services do not have access to the internal metadata endpoint in order to retrieve metadata about the app instance. Instead, much of the metadata that is relevant to the purposes of APM are available in environment variables. The environment variables of interest are documented here.
💚 Build Succeeded
Expand to view the summary
Build stats
Trends 🧪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
How do we determine what PaaS-platforms to include checks for? I feel a little bit like as soon as we start adding some, we can never stop adding new ones as they pop up 😅
We could let it be up to the individual agents what platforms to support, so the PaaS' are optional. Azure's is probably way more used for .NET than for Ruby, for example, where Heroku might be the exact opposite situation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! What method should be used to identify that you're running within Azure App Service? Presence of valid WEBSITE_*
environment variables?
We could let it be up to the individual agents what platforms to support, so the PaaS' are optional.
++
| `instance.id` | `WEBSITE_INSTANCE_ID` | | ||
| `instance.name` | `WEBSITE_SITE_NAME` | | ||
| `project.name` | `WEBSITE_RESOURCE_GROUP` | | ||
| `provider` | azure | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there value in capturing the cloud product, perhaps cloud.product: azure-app-service
as well? It appears we'd need a new cloud ecs field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ I think there could be. cloud fields look to be very much intended for VMs e.g. availability_zone
, machine_type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With elastic/ecs#1204 we will have an ECS field for this as of next release - cloud.service.name
. elastic/apm-server#4625 is tracking addition to the intake for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for somehow capturing the fact that this set of metadata is being captured in an azure-app-services
environment in order to make it distinct from data collected via the instance endpoints. I was thinking similar thoughts when I investigated this for node.js recently specifically around a theoretical problem of a user looking at two sets of azure
data and wondering why different fields are collected from each.
##### Azure App Services | ||
|
||
Azure App Services are a PaaS offering within Azure which doe not | ||
have access to the internal metadata endpoint. Metadata about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What @axw said in an earlier comment:
What method should be used to identify that you're running within Azure App Service? Presence of valid
WEBSITE_*
environment variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The presence of WEBSITE_*
environment variables and the format of WEBSITE_OWNER_NAME
should be sufficient.
Co-authored-by: Trent Mick <[email protected]>
I think this is a reasonable approach. Perhaps I should mark Azure App Services as optional in the spec? |
Marked Azure App Service Metadata as optional. I think the only thing left is to determine a timeline for implementation. @alex-fedotyev / @graphaelli, thoughts on where this might slot in? Happy to write a prototype implementation for the .NET agent too. |
I've opened elastic/apm-agent-dotnet#1083 as an example implementation |
@alex-fedotyev and I discussed this. He's going to investigate adoption across agents and help set priority on this. |
@russcam - did you check if our current logic for collecting cloud metadata would not work for Azure App Services? Also instance ID would be interesting to leverage in setting up service.node.name, how does the agent assign the node names today for AppServices? Did you check if WEBSITE_ env variables are present in the AppServices for Linux? I remember leveraging them on Windows, but not sure about Linux. Azure Functions also set WEBSITE_ environment variables, technically they are part of the App Service infrastructure. From my experience, I recall .NET/Java/Node.js and PHP being well adopted on Azure AppService platform. This looks to me as an improvement worth of doing across at least those language agents. |
| `project.name` | `WEBSITE_RESOURCE_GROUP` | | ||
| `provider` | azure | | ||
| `region` | last part of `WEBSITE_OWNER_NAME`, split by `-`, trim end `"webspace"` | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@russcam datapoint: When I deployed a node application via azure app services my region looked like
"WEBSITE_RESOURCE_GROUP": "appsvc_linux_centralus",
i.e. the WEBSITE_OWNER_NAME
was delimited with underscores characters (_
) and not the hyphen/dash. You can see this here (will be slow in coming up if the app's gone idle)
What do you think about spec-ing this as splitting by -
OR _
-- or perhaps even "splitting by non-alpha-numeric-characters"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional data point. Looks like there may be some cross-language and cross-platform differences in environment variable values. For example, the node app value is
"WEBSITE_OWNER_NAME": "7657426d-c4c3-44ac-88a2-3b2cd59e6dba+appsvc_linux_centralus-CentralUSwebspace-Linux"
The extracted region should be CentralUS
, though the value includes a -Linux
suffix which wasn't present on the .NET app service.
I think what might be good for me to do before updating the PR is to deploy some other language app services to see if there is more variation in values. It might be a simple case of updating the WEBSITE_OWNER_NAME
rule to substring from 0 up to start of webspace
, then split by -
and take the last value.
I've added some gherkin specs to indicate what success and failure scenarios 9768039. With these specs, agents can generate the steps for a test |
What's the status on this spec? Theoretically it's slated for 7.12 which is in two weeks. Can we wrap it up and get it merged so agents can implement? Alternatively we could push it to 7.13, but we should make a decision on that. /cc @AlexanderWert |
This commit updates the Azure App Service Metadata spec to indicate that webspace(.*) should be trimmed from the last part of `WEBSITE_OWNER_NAME` split by '-', in order to get the region.
@basepi good question :) I believe with the addition of gherkin specs with scenarios to demonstrate expected outcomes, this is good to merge- I added a link to the specs and clarified how region is obtained, based on @astorm's input in #365 (comment). I deployed empty Azure App Services for node and python and couldn't replicate the |
In that case, let's make this the last call for input on this spec. @russcam is going to merge it in two days (March 11) unless there is more feedback. |
Thanks for everyone's input, merging this in. |
This commit updates the cloud metadata spec to propose collecting Azure App Service metadata.
Azure App Services are a very popular PaaS offering on Azure. In contrast to Azure VMs, App Services do not have access to the internal metadata endpoint in order to retrieve metadata about the app instance. Instead, much of the metadata that is relevant to the purposes of APM are available in environment variables.
The environment variables of interest are documented here.